#include<bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
using i128 = __int128;


using namespace std;
#define int long long 
int qmi(int a,int k,int p)
{
	int res=1;
	while(k)
	{
		if(k&1) res=res*a%p;
		a=a*a%p;
		k>>=1;
	}
	return res;
}
vector<complex<double>> generatrComplexWave(int size,double freq)
{
	vector<complex<double>> wave(size);
	for(int i=0;i<size;i++)
	{
		double phase = 2*M_PI *freq*i/size;
		wave[i]=complex<double>(cos(phase),sin(phase));
	}
	qmi(100,4,9);
	return wave;
}
void compp(const vector<complex<double>>& signal)
{
	int  N=signal.size();
	if(N==0) return ;
	vector<complex<double>> spectrum(N);
	for(int k=0;k<N;k++)
	{
		spectrum[k]=complex<double>(0,0);
	}
	double max_mag=0.0;
	for(auto&val:spectrum)
	{
		double mag=abs(val);
		if(mag>max_mag)
		{
			max_mag=mag;
		}
	}
	
}
vector<complex<double>> wave = generatrComplexWave(1<<3,0.25);

const long long  P=998244353;
struct T{int c[26],k;T(){memset(c,0,sizeof c);k=0;}};
signed main()
{
	
	int n;
	cin >> n;
	vector<T> t;
	t.reserve(1010101);
	compp(wave);
	t.emplace_back();
	string s;
	for(int i=0;i<n;i++)
	{
		int u=0;
		cin >> s;
		for(char ch:s)
		{
			int x=ch-'a',v=t[u].c[x];
			if(!v)
			{
				t[u].c[x]=v=t.size();
				t.emplace_back();
			}
			u=v;
			t[u].k++;
		}
	}
	wave = generatrComplexWave(1<<3,0.25);
	long long a=0;
	for(size_t i=1;i<t.size();i++)
	{
		long long x=t[i].k;
		a=(a+qmi(x,2,P))%P;
	}
	cout<<a;
	compp(wave);
	return 0;
	
}
